package www.hz.domain.strategy.service.rule.tree.factory;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Service;
import www.hz.domain.strategy.model.valobj.RuleLogicCheckTypeVO;
import www.hz.domain.strategy.model.valobj.RuleTreeVO;
import www.hz.domain.strategy.service.rule.tree.ILogicTreeNode;
import www.hz.domain.strategy.service.rule.tree.factory.engine.IDecisionTreeEngine;
import www.hz.domain.strategy.service.rule.tree.factory.engine.impl.DecisionTreeEngine;

import java.util.Map;

/**
 * @className: DefaultTreeFactory
 * @Description: 规则书工厂
 * @version: v1.８.0
 * @author: hz
 * @date: 2025/3/17 20:51
 */
@Service
public class DefaultTreeFactory {
    private final Map<String, ILogicTreeNode> logicTreeNodeGroup;


    public DefaultTreeFactory(Map<String, ILogicTreeNode> logicTreeNodegroup) {
        this.logicTreeNodeGroup = logicTreeNodegroup;
    }
    public IDecisionTreeEngine openLogicTree(RuleTreeVO ruleTreeVO) {
        return new DecisionTreeEngine(logicTreeNodeGroup, ruleTreeVO);
    }
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class TreeActionEntity{
        private RuleLogicCheckTypeVO ruleLogicCheckType;
        private StrategyAwardVO  strategyAwardData;
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class StrategyAwardVO{
        private Integer awardId;
        private  String awardRuleValue;
    }
}